<?php
declare(strict_types=1);

use Zlf\AppCalculation\Calculation;

if (function_exists('compute') === false) {

    /**
     * @describe 计算器
     * @user zlf <zms-pro@qq.com> 2025/1/20
     * @param string $formula
     * @param int|null $precision
     * @return float
     * @throws Exception
     */
    function compute(string $formula, ?int $precision = null): float
    {
        return Calculation::compute($formula, $precision);
    }
}